"""
# 1. 缩进
for i in range(10):
    print(i)

# 2. 注释

# 打印 1 到 10
for i in range(10):
    print(i)

'''
计算 1 到 10 的总和
'''
def sum_num(n):
    total = 0
    for i in range(n+1):
        total += i
    return total
print(sum_num(10))

# 续行
s = 'abcedfghijklmno\
pqrstuvwxyz'
print(s)

a = 10
print(a)
print(type(a))
print(id(a))
print('=========')
b = "I love you!"
print(b)
print(type(b))
print(id(b))
"""
import math

# 删除变量
'''
a = 12
print(a)
del a
print(a)
'''

# a = 10
# print(a)
#
# a = True
# print(a)
# print(type(a))

# 链式赋值
'''
x = y = 100
print(x,y)

a,b,c = 4,5,6
print(a,b,c)

x,y = 10,20
print(f'交换前的x:{x},y:{y}')
x,y = y,x
print(f'交换后的x:{x},y:{y}')

# 三种进制
a = 0b110
b = 0o173
c = 0xff
print(a,b,c)

a = 17
print(f'十进制转化成二进制:{bin(a)}')
print(f'十进制转化成八进制:{oct(a)}')
print(f'十进制转化成十六进制:{hex(a)}')
'''

# print(int(9.9))
# print(int(True))
# print(int('1234'))
# print(int('123abc'))

# a = 1000**100
# print(a)

# a = 3.14
# print(a)
# b = 2.3e-2
# print(b)

# a = 0.4 - 0.3
# b = 0.1
# print(a == b)
#
# print(math.isclose(a,b))
#
# c = 1.1
# print(c ** 2)

# print(float('12.31'))
# print(float(3))
# print(float(False))
#
# a = 3.14
# b = round(a)
# print(a,b)

'''
c = 3 + 4j
print(c)
print(c ** 2)
print(c.real)           # 获取复数的实部
print(c.imag)           # 获取复数的虚部
print(3+4j.imag)        # 相当于是 3 + (4j.imag)
print(c.conjugate())    # 查看共轭复数
print(abs(c))           # 计算c的模
'''

# import time
# time = time.time() # 获取到当前的时间戳，返回的单位是秒
# print(time)
# # 计算当前的年份 先不考虑是不是闰年
# second = int(time)
# minute = second//60
# hour = minute//60
# day = hour//24
# year = day//365
# print(f'今年是{year+1970}')

# a = 3
# b = True
# c = False
# print(a + b)
# print(a + c)
#
# print('空字符串的布尔类型的值:',bool(""))
# #False
# print('空列表布尔类型的值:',bool([]))
# #False
# print('None布尔类型的值:',bool(None))
# #False
# print('0布尔类型的值:',bool(0))
# #False
# print('字符串True和False转成布尔都是',bool("False")) #True

# a = 7 + 3
# print(a)
# a = 7 -4
# print(a)
# a = 7*2
# print(a)
# a = 7 / 3
# print(a)
# a = 7//3
# print(a)
# a = 7**2
# print(a)
# a = 7 % 3
# print(a)
# a = 7/0
# print(a)


# a,b,c=10,20,30
# print((a<b) and (b<c))
# print((a>b) or (b>c))
# print(not(b<c))
# a,b,c=10,20,30
# print(a <= 20)
#
# print(3 <= b <= 40)
# # 等价于
# print((b>=3) and (b<=40))


# a = 0b11001
# b = 0b01000
# print(bin(a|b)) #bin()可以将数字转成二进制表示
# print(bin(a&b)) #与
# print(bin(a^b)) #异或
# print(3<<2) #左移1位相当于乘以2.左移两位相当于:3*4
# print(20>>1) #右移移位相当于除以2

'''
a = 3
print(a+4)
b = "I love"
c = " YOU"
print(b+c)
d = [10,20,30]
e = [20,30,40]
print(d+e)
'''

'''
a = 3
print(a*3)
b = 'abcd'
print(b*3)
c = [10,20,30]
print(c*2)
'''

# a=20
# b=20
# c=30
# print("a和b是同一个对象",a is b) #执行结果:True
# print("a和c是同一个对象",a is c) #执行结果False
# print("a和c不是同一个对象",a is not c) #执行结果True

a = 1000
b = 1000
print(a is b)
print(a == b)
c = 10
d = 10
print(c is d)
print(c == d)

a = "python"
b = "py"
print(b in a) #True
c = [10,20,30]
print(10 not in c) #False